package domain.domain;

import java.util.ArrayList;
import java.util.Scanner;

public class DemoStudent {
    public static void main(String[] args) {
        ArrayList<Student> ls=new ArrayList<>();
        getStudent(ls);
        getStudent(ls);
        getStudent(ls);
        for (int i = 0; i < ls.size(); i++) {
            System.out.println(ls.get(i).getName()+"....."+ls.get(i).getAge());
        }
        return;
    }

    private static void getStudent(ArrayList<Student> list) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入第"+(list.size()+1)+"个学生姓名:");
        String stu1name=sc.next();
        System.out.println("请输入第"+(list.size()+1)+"个学生年龄:");
        int stu1age=sc.nextInt();
        Student stu=new Student(stu1name,stu1age);
        list.add(stu);
        return ;
    }
    private static void setStudent(ArrayList<Student> list,int i) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入第"+i+"个学生姓名:");
        String stu1name=sc.next();
        System.out.println("请输入第"+i+"个学生年龄:");
        int stu1age=sc.nextInt();
        Student stu=new Student(stu1name,stu1age);
        list.set((i-1),stu);
        return ;
    }

    private static void removestuStudent(ArrayList<Student> list) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入被移除学生的姓名:");
        String stu1name=sc.next();
        System.out.println("请输入被移除学生的年龄:");
        int stu1age=sc.nextInt();
        Student stu=new Student(stu1name,stu1age);
        list.remove(stu);
        return ;
    }

    private static void removeidStudent(ArrayList<Student> list) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入被移除学生所在的索引:");
        int stuid=sc.nextInt();
        list.remove(stuid);
        return ;
    }





}
